$(function () {
  // document.oncontextmenu  = function(){return false;};
  //存储每个tab的app对象
  window.appObj = new Object();

  // $(".app-header-title").html("生物科学实验平台");
  window.app = new Rainier.UI.V2.Application();
  // var menuComponent = new Rainier.UI.V2.AppMenuComponent(app);
  // var controlComponent = new Rainier.UI.V2.AppControlComponent(app);
  // var partLibComponent = new Rainier.UI.V2.AppPartLibComponent(app, $("#app-partlib"));
  // var usedPartLibComponent = new Rainier.UI.V2.AppUsedPartLibComponent(app, $("#app-partlib"));
  // var searchComponent = new Rainier.UI.V2.AppSearchComponent(app, $("#app-partlib"));
  var draw2dEditor = new Rainier.UI.V2.AppExperimentCanvasComponent(app, $("#firstPage"));
  // var previewComponent = new Rainier.UI.V2.AppPreviewComponent(app, $("#app-result"));
  // var propertyComponent = new Rainier.UI.V2.AppPropertyComponent(app, $("#app-result"));
  // var resultComponent = new Rainier.UI.V2.AppExperimentResultComponent(app, $("#app-result"));

  // app.registerViewComponent({ APP_VIEW_COMPONENT_MENU: menuComponent });
  // app.registerViewComponent({ APP_VIEW_COMPONENT_CONTROL: controlComponent });
  // app.registerViewComponent({ APP_VIEW_COMPONENT_PARTLIB: partLibComponent });
  // app.registerViewComponent({ APP_VIEW_COMPONENT_USED_PARTLIB: usedPartLibComponent });
  // app.registerViewComponent({ APP_VIEW_COMPONENT_SEARCH: searchComponent });
  app.registerViewComponent({ APP_VIEW_COMPONENT_CANVAS: draw2dEditor });
  // app.registerViewComponent({ APP_VIEW_COMPONENT_PREVIEW: previewComponent });
  // app.registerViewComponent({ APP_VIEW_COMPONENT_PROPERTY: propertyComponent });
  // app.registerViewComponent({ APP_VIEW_COMPONENT_RESULT: resultComponent });
  idArray = [];
  app.tabLevel = "first";
  app.canvasId = "#FirstPage";
  appObj.firstPage = app;
  idArray.push({ id: "firstPage", tabTitle: "firstPage" });
  expActiveJsonObj = {}; //存储打开实验时 除了首页其他tab界面的json数据 解决点击首页的元器件进入子实验后直接渲染实验

  app.buildGUI(true);
  app.setContextActiveEditor(draw2dEditor.getDraw2DEditor());
  $.outer.init(); //回显实验
  $.menuOpt.init(); //操作
  window.zoom = 1.1; //默认画布缩放比例
  // forceLandscape(); //横屏

  // FastClick.attach(document.body);
});

// data:存放器件类名className和className出现次数addCount的数组。
// 防止重复将器件加入已使用器件树形结构中
// addCount属性在删除以及撤销和恢复中，判断是否将该器件从器件展示栏中删除。
data = [];
// usedPartArry:存放器件数据的数组。在点击已使用器件展示按钮后将此数组添加到树形结构中
usedPartArray = [];

menuArray = [];
isSelectedPreview = false;
